package com.jckl.foodathon.common.util;

import java.util.List;
import java.util.logging.Logger;

import com.beoui.geocell.GeocellManager;
import com.beoui.geocell.model.Point;
import com.google.appengine.api.datastore.GeoPt;

public class GeoLocation {
	
	private static final Logger log = Logger.getLogger(GeoLocation.class.getName());
	
	public GeoPt getGeoPt(double latitude, double longitude){
		GeoPt geoPt = null;
		try{
			geoPt = new GeoPt((float)latitude, (float)longitude);
		}catch (Exception ex){
			log.severe("Failed - unable to get GeoPoint");
			ex.printStackTrace();
		}
		return geoPt;
	}
	
	public List<String> getGeoCells(double latitude, double longitude){
		List<String> cells = null;
		try{
			Point point = new Point(latitude, longitude);
			cells = GeocellManager.generateGeoCell(point);
		}catch (Exception ex){
			log.severe("Failed - unable to get GeoCells");
			ex.printStackTrace();
		}
		return cells;
		
	}

}
